import javax.swing.*;
import java.awt.*;

public class Start extends JFrame {
    private Login loginPanel = new Login(this);
    private Menu menuPanel = new Menu(this);
    private Deposit cun = new Deposit(this);
    private Take que = new Take(this);
    private Check cha = new Check(this);
    private Transfer zha=new Transfer(this);
    private Modify gai=new Modify(this);
    private Image bgImg = Util.getImage("/images/background.jpg");
    private CardLayout cardLayout = new CardLayout();
    private User user = new User();

    public Modify getGai() {
        return gai;
    }

    public void setGai(Modify gai) {
        this.gai = gai;
    }

    public Transfer getZha() {
        return zha;
    }

    public void setZha(Transfer zha) {
        this.zha = zha;
    }

    public Take getQue() {
        return que;
    }

    public void setQue(Take que) {
        this.que = que;
    }

    public Deposit getCun() {
        return cun;
    }

    public void setCun(Deposit cun) {
        this.cun = cun;
    }

    public Login getLoginPanel() {
        return loginPanel;
    }

    public void setLoginPanel(Login loginPanel) {
        this.loginPanel = loginPanel;
    }

    public Check getCha() {
        return cha;
    }

    public void setCha(Check cha) {
        this.cha = cha;
    }


    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Start() {
        user.init();
        this.setContentPane(new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(bgImg, 0, 0, 800, 600, this);
            }
        });
        this.setLayout(cardLayout);
        this.add("login", loginPanel);
        this.add("menu", menuPanel);
        this.add("Cun", cun);
        this.add("Que", que);
        this.add("Cha", cha);
        this.add("Zha", zha);
        this.add("Gai",gai);
        this.setSize(800, 600);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
    }

    public void switchPanel(String name) {
        cardLayout.show(this.getContentPane(), name);
    }


    public static void main(String[] args) {
        new Start();
    }
}

